<template>
  <div class="home">
    <van-search v-model="convalue" disabled shape="round" background="#ffffff" placeholder="请输入搜索关键词"
      @click="Gotopupop()" />
    <van-swipe class="my-swipe" indicator-color="#000000">
      <van-swipe-item v-for=" item in banner" :key="item.id">
        <img :src="item.image_url" width="100%" style="display: block;">
      </van-swipe-item>

    </van-swipe>
    <transition name="van-slide-right">
      <router-view />
    </transition>

  </div>
</template>

<script>

  // @ is an alias to /src
  
  import {
    GetHomeData
  } from "@/request/api"
  export default {
    name: 'Home',
      components: {
     
  },
    data() {
      return {
        convalue: '',
        //轮播图数组
        banner: []
      }
    },
    created() {
      GetHomeData().then(res => {
          if (res.errno == 0) {
            console.log(res.data);
            let {
              banner
            } = res.data;
            this.banner = banner;
          }
        })
        .catch(err => {
          console.log(err);
        })
    },
    methods: {
      Gotopupop() {
        this.$router.push('/home/popup')
      }
    }
  }
</script>
<style lang="less" scoped>
  .slide-enter,
  .slide-leave-to {
    right: -100%;
  }

  .slide-enter-active,
  .slide-leave-active {
    transition: right 1s linear;
  }

  .slide-enter-to,
  .slide-leave {
    right: 0;
  }
</style>
